package cn.sylinx.redis.springboot;

import cn.sylinx.common.ext.res.Resource;
import redis.clients.jedis.Jedis;
import redis.clients.util.Pool;

public class JedisPoolResource implements Resource<Jedis> {

	private Pool<Jedis> pool;

	public JedisPoolResource(Pool<Jedis> pool) {
		this.pool = pool;
	}

	@Override
	public Jedis get() {
		return pool.getResource();
	}

	@Override
	public void close(Jedis resource) {
		resource.close();
	}
}
